
import 'package:flutter/material.dart';
import 'package:flutter_trip_demo/pages/index_pages.dart';
import 'package:flutter_trip_demo/provider/image_random_number.dart';
import 'package:provider/provider.dart';

///主页面创建
void main() {
  //注册providers供应商
  runApp(MultiProvider(
    providers:[
      ChangeNotifierProvider(create: (_) => ImageRandomNumber(),)
    ],
    child: const MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
     //进行调用
     const Homepage();
    return MaterialApp(
      debugShowCheckedModeBanner: false,  ///取消debug样式
      title: 'Flutter之旅',               ///项目主题
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      // home: const IndexPages(),
      home: const IndexPages(),
    );
  }
}
/*
* 进行屏幕适配
* */
class Homepage extends StatelessWidget {
  const Homepage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    final EdgeInsets padding=MediaQuery.of(context).padding;
    return Container(
      padding: EdgeInsets.fromLTRB(0, padding.top, 0, padding.bottom),
      decoration: const BoxDecoration(color: Colors.greenAccent),
      child: SafeArea(
        child:Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
        ) ,
      ),
    );
  }
}
